<?php
class Pages extends CI_Controller{
	public function __construct(){
		parent::__construct();
		if(!isset($_SESSION)){session_start();}
	}
	
	public function view($page = 'home'){
		if(isset($_SESSION['user_id'])){ $page = 'logged'; }
		if(!file_exists('application/views/pages/'.$page.'.php')){
			show_404();
		}
		$data['title'] = ucfirst($page);
	
		$this->load->view('templates/header',$data);
		$this->load->view('pages/'.$page,$data);
		$this->load->view('templates/footer',$data);	
	}
}
?>